package com.payment.web.controller.app;

import java.math.BigDecimal;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.payment.common.base.AjaxResult;
import com.payment.system.service.IAcqService;

@Controller
@RequestMapping("/app/pay")
public class AppPayController {
	private static final Logger logger4J = LoggerFactory
			.getLogger(IAcqService.class);
	@Autowired
	private IAcqService acqService;
	/**
	 * 无卡消费
	 * @param merchanId  商户id
	 * @param bankId     信用卡ID
	 * @param orderAmount 金额 
	 * @param ip 手机ip
	 * @param region 城市
	 * @param deviceId 设备id  安卓：IMEI IOS：IDFV
	 * @return
	 */
	@PostMapping("/quickPay")
	@ResponseBody
	public AjaxResult quickPay(String merchanId,String bankId
			,BigDecimal orderAmount,String ip,String region,String deviceId) {
		try {
			return acqService.quickPay(merchanId,bankId,orderAmount,ip,region,deviceId);
		} catch (Exception e) {
			e.printStackTrace();
			logger4J.error("消费失败，请联系客服："+e.toString());
			return AjaxResult.error("消费失败，请联系客服");
		}
	}
}
